﻿#include "sessionsocket.h"
#include "listensocket.h"
#include "socketlibfunction.h"

SocketLib::SessionSocket::SessionSocket()
{
    m_listenSocket = NULL;
}

void SocketLib::SessionSocket::setListenSocket(ListenSocket* pListenSocket)
{
    if (NULL == m_listenSocket)
    {
        m_listenSocket = pListenSocket;
    }
}

void SocketLib::SessionSocket::onClose()
{
    if (NULL != m_listenSocket)
    {
        m_listenSocket->addFreeSocketFD(this);
    }

    onClientDisConnection();
}

void SocketLib::SessionSocket::disSocket()
{
    if (NULL != m_listenSocket)
    {
        m_listenSocket->disSocketFD(this);
    }

    init();
}
